<?php /* Smarty version Smarty-3.1.18, created on 2017-07-22 21:21:14
         compiled from "/Applications/MAMP/htdocs/PHP/jifenshop/protected/template/wap/mall.order.list.html" */ ?>
<?php /*%%SmartyHeaderCode:18091774455973514ac25919-19920449%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'ea3eb404689152d9f069d76b9e1dbe9394947207' => 
    array (
      0 => '/Applications/MAMP/htdocs/PHP/jifenshop/protected/template/wap/mall.order.list.html',
      1 => 1477107877,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '18091774455973514ac25919-19920449',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'data' => 0,
    'g' => 0,
    'p' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.18',
  'unifunc' => 'content_5973514ac79a17_12625360',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_5973514ac79a17_12625360')) {function content_5973514ac79a17_12625360($_smarty_tpl) {?><body class="gr">

<div class="navBar">
	<a class="left" href="wap.php?app=member&act=index"><i class="return"></i></a>
	<div class="titleView">积分商城订单</div>
</div>

<div class="member-order member-mall-order main-padding-top">
	<div class="pullRefresh overflow-scroll">
		<?php if (count($_smarty_tpl->tpl_vars['data']->value)>0) {?>
		<ul class="list tableView tableView-noLine">
			<?php  $_smarty_tpl->tpl_vars['g'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['g']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['data']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['g']->key => $_smarty_tpl->tpl_vars['g']->value) {
$_smarty_tpl->tpl_vars['g']->_loop = true;
?>
			<li>
				<div class="view">
					<a href="?app=member&act=order_detail&integral_order=1&id=<?php echo $_smarty_tpl->tpl_vars['g']->value->id;?>
">
						<div class="status ge-bottom ge-light status<?php echo $_smarty_tpl->tpl_vars['g']->value->status;?>
"><font>订单号：<?php echo $_smarty_tpl->tpl_vars['g']->value->order_sn;?>
</font><div><?php echo $_smarty_tpl->tpl_vars['g']->value->status;?>
</div><?php if ($_smarty_tpl->tpl_vars['g']->value->status>0&&$_smarty_tpl->tpl_vars['g']->value->ask_refund_time>0) {?><span>(退货退款中)</span><?php }?></div>
						<ul>
							<?php  $_smarty_tpl->tpl_vars['p'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['p']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['g']->value->goods; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['p']->key => $_smarty_tpl->tpl_vars['p']->value) {
$_smarty_tpl->tpl_vars['p']->_loop = true;
?>
							<li>
								<div class="gview">
									<div class="pic" style="background-image:url(<?php echo $_smarty_tpl->tpl_vars['p']->value->goods_pic;?>
);"></div>
									<div class="name"><?php echo $_smarty_tpl->tpl_vars['p']->value->goods_name;?>
</div>
									<div class="spec"><span class="price"><?php echo $_smarty_tpl->tpl_vars['p']->value->integral;?>
积分</span></div>
								</div>
							</li>
							<?php } ?>
						</ul>
					</a>
				</div>
			</li>
			<?php } ?>
		</ul>
		<?php } else { ?>
		<div class="norecord">当前没有任何订单</div>
		<?php }?>
	</div>
</div>

<script>
var offset = $('.pullRefresh .list > li').length;
function createHtml(g){
	var html = '<li>\
		<div class="view">\
			<a href="?app=member&act=order_detail&integral_order=1&id='+g.id+'">\
				<div class="status ge-bottom ge-light status'+g.status+'"><font>订单号：'+g.order_sn+'</font><div>'+statusName(g.status)+'</div>'+((g.status>0 && g.ask_refund_time>0)?'<span>(退货退款中)</span>':'')+'</div>\
				<ul>';
				for(var i=0; i<g.goods.length; i++){
				html += '<li>\
						<div class="gview">\
							<div class="pic" style="background-image:url('+g.goods[i].goods_pic+');"></div>\
							<div class="name">'+g.goods[i].goods_name+'</div>\
							<div class="spec"><span class="price">'+g.goods[i].integral+'积分</span></div>\
						</div>\
					</li>';
				}
				html += '</ul>\
			</a>\
		</div>\
	</li>';
	offset++;
	return html;
}
function statusName(status){
	var name = '';
	switch(status*1){
		case -3:name = '已退货';break;
		case -2:name = '已退款';break;
		case -1:name = '取消';break;
		case 0:name = '待付款';break;
		case 1:name = '待发货';break;
		case 2:name = '待收货';break;
		case 3:
		case 4:name = '完成';break;
	}
	return name;
}
function setInfo(){
	$('.gview .pic').loadbackground();
}
$(function(){
	$('.member-order').height($.window().height-$('.member-order').padding().top);
	$('.tableView .status div').html(function(i, html){ return statusName(html) });
	setInfo();
	$('.pullRefresh').pullRefresh({
		header : true,
		footer : true,
		footerNoMoreText : '- END -',
		refresh : function(fn){
			var _this = this;
			offset = 0;
			$.getJSON('api.php?app=member&act=order&integral_order=1&status='+_this.attr('status'), function(json){
				if(json.error!=0){ $.overloadError(json.msg);return }
				var html = '';
				if($.isArray(json.data))for(var i=0; i<json.data.length; i++)html += createHtml(json.data[i]);
				_this.find('.tableView').html(html);
				setInfo();
				fn();
			});
		},
		load : function(fn){
			var _this = this;
			$.getJSON('api.php?app=member&act=order&integral_order=1&status='+_this.attr('status'), { offset:offset }, function(json){
				if(json.error!=0){ $.overloadError(json.msg);return }
				var html = '';
				if($.isArray(json.data))for(var i=0; i<json.data.length; i++)html += createHtml(json.data[i]);
				_this.find('.tableView').append(html);
				setInfo();
				fn();
			});
		}
	});
});
</script><?php }} ?>
